import apiClient from '@/api/apiClient.ts';
import { AlarmInfo, LocationInfo, ParkingLocationInfo } from '#/entity.ts';
import { Page } from '#/api.ts';

export enum HistoryReplayApi {
  GetAlarmList = '/roadCure/location/getAlarmList',
  GetLocationList = '/roadCure/location/getLocationList',
  GetParkingLocationList = '/roadCure/location/getParkingLocationList',
}

export interface AlarmListParams {
  plateNumber: string;
  startTime: string;
  endTime: string;
}

const getAlarmList = (data: AlarmListParams & Page) =>
  apiClient.post<AlarmInfo[]>({
    url: HistoryReplayApi.GetAlarmList,
    data,
  });

interface LocationListParams extends AlarmListParams {
  space: number;
  duration: number;
}

const getLocationList = (data: LocationListParams) =>
  apiClient.post<LocationInfo[]>({
    url: HistoryReplayApi.GetLocationList,
    data,
  });

const getParkingLocationList = (data: LocationListParams) =>
  apiClient.post<ParkingLocationInfo[]>({
    url: HistoryReplayApi.GetParkingLocationList,
    data,
  });

export default {
  getAlarmList,
  getLocationList,
  getParkingLocationList,
};
